﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CommunicatorHistoryViewer.Models;

namespace CommunicatorHistoryViewer.Controls
{
    public partial class Contact : UserControl
    {
        public ContactViewModel ViewModel { get; set; }

        public Contact(ContactViewModel viewModel)
        {
            this.ViewModel = viewModel;
            InitializeComponent();
            this.ContactName.Content = this.ViewModel.Name;
            this.ContactName.MouseLeftButtonUp += new MouseButtonEventHandler(ContactName_MouseLeftButtonUp);
        }

        void ContactName_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            (new HistoryView(this.ViewModel)).Show();
        }

        #region [ Events ]

        private void ContactName_MouseEnter(object sender, MouseEventArgs e)
        {
            ContactName.Foreground  = new SolidColorBrush(Color.FromRgb(12, 149, 214));
            Selector.Foreground = new SolidColorBrush(Color.FromRgb(12, 149, 214));
        }

        private void ContactName_MouseLeave(object sender, MouseEventArgs e)
        {
            ContactName.Foreground = new SolidColorBrush(Color.FromRgb(80, 80, 80));
            Selector.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
        }

        #endregion
    }
}
